<?php session_start();
	include 'ref.php';
	
	if (!isset($_SESSION['nowa'])) {
		session_regenerate_id();
		$_SESSION['block'] = false;
		$_SESSION['nowa'] = true;
		$_SESSION['adresuzytkownika'] = $_SERVER['REMOTE_ADDR'];
	}

	if($_SESSION['adresuzytkownika'] != $_SERVER['REMOTE_ADDR']) {
		session_destroy();
	}
	error_reporting(E_ALL & ~E_NOTICE);
	if(isset($_SESSION['zalogowany']) && $_SESSION['zalogowany']==true) {
		//--------------------------------------------------------------------------------------------------------
		$specId = $_GET['specChosen'];

		include 'dbConnection.php';

		$result = mssql_query("EXECUTE GetPrzedmioty $specId");

		while($row = mssql_fetch_array($result)) {
			$nazwa = iconv("CP1250","utf-8",$row['nazwa']);
			echo '<span class="subj" id="subj_'.$row['id'].'" onclick="getWyklady('.$row['id'].')">'.$nazwa.'</span>';//<br />';
		}
		mssql_free_result($result);
		mssql_close($con);
		//--------------------------------------------------------------------------------------------------------
	}
	else {
		header("Location: logowanie.php");
		exit;
	}
?>
